import { createSlice } from '@reduxjs/toolkit'
import type { PayloadAction } from '@reduxjs/toolkit'

export interface ThemeState {
    value: string
}

const initThemeState: ThemeState = {
    value: 'light'
}

export const themeSlice = createSlice({
    name: 'theme',
    initialState: initThemeState,
    reducers: {
        updateTheme(state, action: PayloadAction<string>) {
            state.value = action.payload
        }
    }
})

export const { updateTheme } = themeSlice.actions

export default themeSlice.reducer